package com.kuangstudy.common.demo5;

/**
 * ClassName: Test
 * date: 2021/07/14 12:36:34
 *
 * @author zlk
 */
public class Test {
    public static void main(String[] args) {
        Student s1 = new Student("kk", 20);
        Student s2 = new Student("kk1", 30);
        /*判断s1和s2是不是同一个类型*/
        Class<? extends Student> class1 = s1.getClass();
        Class<? extends Student> class2 = s2.getClass();
        System.out.println(class1);
        System.out.println(class2);
        if (class1.equals(class2)){
            System.out.println("同一类型");
        }
        System.out.println(s1.hashCode());
        System.out.println(s2.hashCode());
        Student s3 = s1;
        System.out.println(s3.hashCode());
        System.out.println(s1);
        /*equals方法 判断两个对象是否相等*/
        Student s4 = new Student("kk", 20);
        System.out.println(s1.equals(s4));


    }
}
